package com.asia5b.a5mall.middleware.utils

import android.content.Context
import android.net.Uri
import android.os.Build
import androidx.core.content.FileProvider
import java.io.File

/**
 * Created by zhangyuncai on 2020/6/8.
 */
object UriUtil {
    fun getUri(context: Context, file: File): Uri {
        val uri: Uri
        if (Build.VERSION.SDK_INT >= 24) {
            uri = FileProvider.getUriForFile(context, "${AppUtil.getPackageName()}.fileProvider", file)
        } else {
            uri = Uri.fromFile(file)
        }
        return uri
    }
}